package com.azusa.xbjy.controller;

import com.azusa.xbjy.dao.DeptDao;
import com.azusa.xbjy.entity.Result;
import com.azusa.xbjy.entity.StatusCode;
import com.azusa.xbjy.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

@RestController
@RequestMapping("dept")
public class DeptController {

    @Autowired
    private DeptService deptService;

    @RequestMapping("toDept")
    public ModelAndView toDept(){
        return new ModelAndView("department/department");
    }

    @RequestMapping("findAll")
    public Result findAll(){
        return new Result(StatusCode.SUCCESS,deptService.findAll());
    }

    @RequestMapping("findDeptAll")
    public Result findDeptAll(){
        return new Result(StatusCode.SUCCESS,deptService.findDeptAll());
    }
}
